--编写者：alt
--功能介绍：霸体
--使用方法：直接粘贴 修改xxx_ignorecontrol
--此文件如果要适配模组的话需要一个个的适配 具体看你单主的需求
--霸体
local controltable = {
    ["knockback"] = true,
    ["mindcontrolled"] = true,
    ["devoured"] = true,
    ["repelled"] = true,
    ["startled"] = true,
    ["snared"] = true,
    ["attacked"] = true,
    ["suspended"] = true,
    ["feetslipped"] = true,
    ["consumehealthcost"] = true,
    ["onfallinvoid"] = true,
    ["toolbroke"] = true,
    ["armorbroke"] = true,
    ["knockedout"] = true,
    yawn = true,
    pinned = true,
    freeze = true,
    wonteatfood = true,
    spooked = true,
    acting = true,
    monkeycursehit = true,
    electrocute = true,
    ridersleep = true,

    recoil_off = true, --攻击涟漪[新墨荒]会被弹开
}

local oldStateGraphInstancePushEvent = StateGraphInstance.PushEvent
function StateGraphInstance:PushEvent(eventname, data, ...)
    if controltable[eventname] then
        local inst = self.inst
        if inst
            and inst:HasTag("xxx_ignorecontrol") then
            return
        end
    end
    return oldStateGraphInstancePushEvent(self, eventname, data, ...)
end

local oldHandleEvent = StateGraphInstance.HandleEvent
function StateGraphInstance:HandleEvent(eventname, data, ...)
    if controltable[eventname] then
        local inst = self.inst
        if inst
            and inst:HasTag("xxx_ignorecontrol") then
            return
        end
    end
    return oldHandleEvent(self, eventname, data, ...)
end

--[[ local oldHasStateTag = StateGraphInstance.HasStateTag
function StateGraphInstance:HasStateTag(tag, ...)
    if self.inst:HasTag("xxx_ignorecontrol") and tag == "busy" then
        return false
    end
    return oldHasStateTag(self, tag, ...)
end

local oldHasTag = EntityScript.HasTag
function EntityScript:HasTag(tag, ...)
    if oldHasTag(self, "xxx_ignorecontrol") and tag == "busy" then
        return false
    end
    return oldHasTag(self, tag, ...)
end ]]
